
/**
 * 菜单视图js
 */
Ext.namespace("oa.functions.index");

oa.functions.index.main = function() {
	Ext.create("Ext.panel.Panel", {
		width : "100%",
		height : "100%",
		renderTo : "function_index",
		layout : "border",
		items : [oa.functions.tree.view, oa.functions.table.view]
	});
};

/**
 * 刷新树和表格（当添加或修改数据时）
 */
oa.functions.index.refresh = function() {

	oa.functions.table.store.load({
		scope : this,
		callback : function(records, operation, success) {
			console.log(records);
		}
	});
	oa.functions.tree.store.load({
		scope : this,
		callback : function(records, operation, success) {
			oa.functions.tree.view.expandAll();
			if (oa.functions.tree.selectNode) {
				oa.functions.tree.view.getSelectionModel().select(oa.functions.tree.selectNode);
			}
			console.log(records);
		}
	});
}

/**
 * 刷新树和表格（当添加或修改数据时）
 */
oa.functions.index.refreshTable = function() {

	oa.functions.table.store.load({
		scope : this,
		callback : function(records, operation, success) {
			console.log(records);
		}
	});
}

Ext.onReady(function() {
	oa.functions.index.main();
})
